package com.example.java1query.infrastructure;

import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class RandomEx {
    private Random random = new Random();

    public synchronized String nextString(String prefix){
        return prefix+String.format("%06d",random.nextInt(1000000));
    }

    public Integer nextInt(Integer start,Integer length){
        return start+random.nextInt(length);
    }

    public String nextName(String prefix){
        return prefix+random.nextInt(10)+names[random.nextInt(names.length)];
    }

    public static final String[] names = {"Tommy","Lucy","Lily","Tony","Bruce","Judy","Ketty","Jack","Rose"};

}
